<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SC2API: include/sc2api/sc2_types.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="SC2-Logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SC2API
   </div>
   <div id="projectbrief">An API for AI for StarCraft II</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_3d0dfd3160b31ffa512c49330ac8d646.html">sc2api</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">sc2_types.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="sc2__types_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacesc2.html">sc2</a> {</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;</div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html">   19</a></span>&#160;<span class="keyword">class </span><a class="code" href="classsc2_1_1_s_c2_type.html">SC2Type</a> {</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a797ecedf348b295b1827f6cd875843e7">   22</a></span>&#160;    <a class="code" href="classsc2_1_1_s_c2_type.html#a797ecedf348b295b1827f6cd875843e7">SC2Type</a>() :</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;        type_id_(0) {</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    }</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#adda8c2ecd47bf1fe93ad54726404674f">   26</a></span>&#160;    <a class="code" href="classsc2_1_1_s_c2_type.html#adda8c2ecd47bf1fe93ad54726404674f">SC2Type</a>(uint32_t type_id) :</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;        type_id_(type_id) {</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    }</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#ac956d32e3d7989b2e0ab2664c9822d16">   30</a></span>&#160;    <a class="code" href="classsc2_1_1_s_c2_type.html#ac956d32e3d7989b2e0ab2664c9822d16">SC2Type</a>(T type_id) :</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        type_id_(static_cast&lt;uint32_t&gt;(type_id)) {</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    }</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a499b06e107c0561ce3d2d80094fbdd94">   36</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a499b06e107c0561ce3d2d80094fbdd94">operator ==</a>(<a class="code" href="classsc2_1_1_s_c2_type.html">SC2Type&lt;T&gt;</a> type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ == type_id.type_id_; }</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a499b06e107c0561ce3d2d80094fbdd94">operator ==</a>(T type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ == <span class="keyword">static_cast&lt;</span>uint32_t<span class="keyword">&gt;</span>(type_id); }</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a499b06e107c0561ce3d2d80094fbdd94">operator ==</a>(uint32_t type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ == type_id; }</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a499b06e107c0561ce3d2d80094fbdd94">operator ==</a>(<span class="keywordtype">int</span> type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>uint32_t<span class="keyword">&gt;</span>(type_id_) == type_id; }</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a6e032550a699843364b52d9f30d7ddcc">   43</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a6e032550a699843364b52d9f30d7ddcc">operator !=</a>(<a class="code" href="classsc2_1_1_s_c2_type.html">SC2Type&lt;T&gt;</a> type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ != type_id.type_id_; }</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a6e032550a699843364b52d9f30d7ddcc">operator !=</a>(T type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ != <span class="keyword">static_cast&lt;</span>uint32_t<span class="keyword">&gt;</span>(type_id); }</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a6e032550a699843364b52d9f30d7ddcc">operator !=</a>(uint32_t type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ != type_id; }</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a6e032550a699843364b52d9f30d7ddcc">operator !=</a>(<span class="keywordtype">int</span> type_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>uint32_t<span class="keyword">&gt;</span>(type_id_) != type_id; }</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a9ad0dc8b2a47eca60fa3a49c9c2e5de0">   49</a></span>&#160;    <span class="keywordtype">bool</span> operator&lt;(const SC2Type&lt;T&gt;&amp; other) <span class="keyword">const</span> { <span class="keywordflow">return</span> type_id_ &lt; other.type_id_; }</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#ab75e39605288070327604d10a5f720bf">   52</a></span>&#160;    <span class="keyword">operator</span> uint32_t()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_; }</div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a16ef14791e484bcb2708d262fbfbc46f">   54</a></span>&#160;    <span class="keyword">operator</span> T()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T<span class="keyword">&gt;</span>(type_id_); }</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a359fd3f5911b611089dac072f2ba528f">   58</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsc2_1_1_s_c2_type.html#a359fd3f5911b611089dac072f2ba528f">IsValid</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> type_id_ != 0; }</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#a25533b72e301be4064d80a13c82dc506">   62</a></span>&#160;    std::string <a class="code" href="classsc2_1_1_s_c2_type.html#a25533b72e301be4064d80a13c82dc506">to_string</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> std::to_string(type_id_); }</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="classsc2_1_1_s_c2_type.html#ada2d70972edaa615780f86165b7e87a3">   66</a></span>&#160;    T <a class="code" href="classsc2_1_1_s_c2_type.html#ada2d70972edaa615780f86165b7e87a3">ToType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T<span class="keyword">&gt;</span>(type_id_); }</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    uint32_t type_id_;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;};</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;}</div><div class="ttc" id="classsc2_1_1_s_c2_type_html_adda8c2ecd47bf1fe93ad54726404674f"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#adda8c2ecd47bf1fe93ad54726404674f">sc2::SC2Type::SC2Type</a></div><div class="ttdeci">SC2Type(uint32_t type_id)</div><div class="ttdoc">Construct from an integer, corresponds to the enum value. </div><div class="ttdef"><b>Definition:</b> sc2_types.h:26</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_a499b06e107c0561ce3d2d80094fbdd94"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#a499b06e107c0561ce3d2d80094fbdd94">sc2::SC2Type::operator==</a></div><div class="ttdeci">bool operator==(SC2Type&lt; T &gt; type_id) const</div><div class="ttdef"><b>Definition:</b> sc2_types.h:36</div></div>
<div class="ttc" id="namespacesc2_html"><div class="ttname"><a href="namespacesc2.html">sc2</a></div><div class="ttdef"><b>Definition:</b> sc2_action.h:9</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_a25533b72e301be4064d80a13c82dc506"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#a25533b72e301be4064d80a13c82dc506">sc2::SC2Type::to_string</a></div><div class="ttdeci">std::string to_string() const</div><div class="ttdef"><b>Definition:</b> sc2_types.h:62</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_ac956d32e3d7989b2e0ab2664c9822d16"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#ac956d32e3d7989b2e0ab2664c9822d16">sc2::SC2Type::SC2Type</a></div><div class="ttdeci">SC2Type(T type_id)</div><div class="ttdoc">Construct from the enum. </div><div class="ttdef"><b>Definition:</b> sc2_types.h:30</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_a797ecedf348b295b1827f6cd875843e7"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#a797ecedf348b295b1827f6cd875843e7">sc2::SC2Type::SC2Type</a></div><div class="ttdeci">SC2Type()</div><div class="ttdoc">Default constructor. </div><div class="ttdef"><b>Definition:</b> sc2_types.h:22</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_ada2d70972edaa615780f86165b7e87a3"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#ada2d70972edaa615780f86165b7e87a3">sc2::SC2Type::ToType</a></div><div class="ttdeci">T ToType() const</div><div class="ttdef"><b>Definition:</b> sc2_types.h:66</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html">sc2::SC2Type</a></div><div class="ttdef"><b>Definition:</b> sc2_types.h:19</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_a6e032550a699843364b52d9f30d7ddcc"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#a6e032550a699843364b52d9f30d7ddcc">sc2::SC2Type::operator!=</a></div><div class="ttdeci">bool operator!=(SC2Type&lt; T &gt; type_id) const</div><div class="ttdef"><b>Definition:</b> sc2_types.h:43</div></div>
<div class="ttc" id="classsc2_1_1_s_c2_type_html_a359fd3f5911b611089dac072f2ba528f"><div class="ttname"><a href="classsc2_1_1_s_c2_type.html#a359fd3f5911b611089dac072f2ba528f">sc2::SC2Type::IsValid</a></div><div class="ttdeci">bool IsValid() const</div><div class="ttdef"><b>Definition:</b> sc2_types.h:58</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
